﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AGMLite.ViewModelClass;
using AGMLite.BaseClass;

namespace AGMLite.UserControl
{
    /// <summary>
    /// Interaction logic for ItemsUserControl.xaml
    /// </summary>
    public partial class ItemsUserControl : System.Windows.Controls.UserControl
    {
        public ItemsUserControl()
        {
            InitializeComponent();
        }
    }

    public class ItemStatusConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            BitmapImage img = new BitmapImage();
            int status = (int) value;

            switch(status)
            {
                case 1: // warn
                    img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/redwarn.png"));
                    break;
                case 2: // new coming
                    img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/new.png"));
                    break;
                case 3: // sync
                    img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/sync.png"));
                    break;
                case 4: // pause
                    img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/pause.png"));
                    break;
            }

            return img;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    public class EntityTypeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            BitmapImage img = new BitmapImage();
            Common.AGMLiteEnum.EntityType entitytype = (Common.AGMLiteEnum.EntityType)value;

            switch (entitytype)
            {
                case Common.AGMLiteEnum.EntityType.Requirement:
                    img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/req.png"));
                    break;
                case Common.AGMLiteEnum.EntityType.ProjectTask:
                    img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/task.png"));
                    break;
                case Common.AGMLiteEnum.EntityType.Defect:
                    img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/bug.png"));
                    break;
            }

            return img;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
